package com.atguigu.gulimall.basic.minio.config;

import com.atguigu.gulimall.basic.minio.service.MinioService;
import com.atguigu.gulimall.basic.minio.utils.MinioUtil;
import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 *     goFastDfs自动配置类
 *     配置类，基于Java代码的bean配置
 * *   @EnableConfigurationProperties与@ConfigurationProperties：读取配置文件转换为bean
 * *   @EnableAutoConfiguration与@Import：实现bean发现与加载
 * </p>
 *
 * @author : yhd
 * @since : 2023-04-27 20:20
 */
@Configuration
@EnableConfigurationProperties({MinioProperties.class,MinioUtil.class})
@RequiredArgsConstructor
public class ServiceAutoConfiguration {

    /**
     * 实例化MinioService并载入Spring IoC容器
     */
    @Bean
    public MinioService minioService(MinioUtil minioUtil, MinioProperties minioProperties){
        return new MinioService(minioUtil, minioProperties);
    }


}
